package cart.api.vo;

import javax.persistence.Column;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 临时订单项目VO
 * Created by Liang Wenxu on 2017/1/19.
 */
public class TempOrderItemVo implements Serializable {
    private String cartItemId;

    private String storeId;

    private String productId;

    private String productCode;

    private String productFashionId;

    private String goodsId;

    /**
     * 产品名称
     */
    private String fashionTitle;

    /**
     * 购买数量
     */
    private Integer count;

    /**
     * 状态 1-- 正常 2-- 已下架/无法购买 99-- 库存状态未知（预留）
     */
    private String status;

    /**
     * 展示图片url
     */
    private String fashionPic;

    /**
     * 单价
     */
    private BigDecimal salePrice;

    /**
     * 协议价
     */
    private BigDecimal costPrice;

    /**
     * 协议价合计
     */
    private BigDecimal sumCostPrice;

    /**
     * 商品总价合计（单价*数量）
     */
    private BigDecimal sumSalePrice;

    /**
     * 商品市场价
     * @return
     */
    private BigDecimal marketPrice;

    /**
     * 商品市场价合计
     * @return
     */
    private BigDecimal sumMarketPrice;

    /**
     * 规格名称，用于展示名称
     * */
    private String fieldName;

    /**
     * 规格代码
     */
    private String fieldCode;

    /**
     * 数据类型
     * 1为文字 2为图片
     * */
    private String fieldType;

    /**
     * 规格值
     */
    private String value;

    /**
     * 规格值名称
     */
    private String valueName;

    /**
     * 库存数量
     */
    private Long stockCount;

    /**
     * 库存预警
     */
    private Integer lackRemind;




    public String getProductId() {
        return productId;
    }

    public void setProductId(String productId) {
        this.productId = productId;
    }

    public String getProductFashionId() {
        return productFashionId;
    }

    public void setProductFashionId(String productFashionId) {
        this.productFashionId = productFashionId;
    }

    public String getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(String goodsId) {
        this.goodsId = goodsId;
    }

    public String getStoreId() {
        return storeId;
    }

    public void setStoreId(String storeId) {
        this.storeId = storeId;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
        this.count = this.count == null ? 1 : this.count;
        if(this.sumSalePrice != null) {
            this.sumSalePrice = salePrice.multiply(BigDecimal.valueOf(this.count)).setScale(2, BigDecimal.ROUND_HALF_UP);
        }
        if(this.sumMarketPrice != null) {
            this.sumMarketPrice = marketPrice.multiply(BigDecimal.valueOf(this.count)).setScale(2, BigDecimal.ROUND_HALF_UP);
        }
        if(this.sumCostPrice != null) {
            this.sumCostPrice = costPrice.multiply(BigDecimal.valueOf(this.count)).setScale(2, BigDecimal.ROUND_HALF_UP);
        }
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public BigDecimal getSalePrice() {
        return salePrice;
    }

    public void setSalePrice(BigDecimal salePrice) {
        this.salePrice = salePrice.setScale(2, BigDecimal.ROUND_HALF_UP);
        this.count = this.count == null ? 1 : this.count;
        this.sumSalePrice = salePrice.multiply(BigDecimal.valueOf(this.count)).setScale(2, BigDecimal.ROUND_HALF_UP);
    }

    public BigDecimal getSumSalePrice() {
        return sumSalePrice;
    }

    public void setSumSalePrice(BigDecimal sumSalePrice) {
        this.sumSalePrice = sumSalePrice;
    }

    public String getFashionPic() {
        return fashionPic;
    }

    public void setFashionPic(String fashionPic) {
        this.fashionPic = fashionPic;
    }

    public BigDecimal getMarketPrice() {
        return marketPrice;
    }

    public void setMarketPrice(BigDecimal marketPrice) {
        this.marketPrice = marketPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
        this.count = this.count == null ? 1 : this.count;
        this.sumMarketPrice = marketPrice.multiply(BigDecimal.valueOf(this.count)).setScale(2, BigDecimal.ROUND_HALF_UP);
    }

    public BigDecimal getSumMarketPrice() {
        return sumMarketPrice;
    }

    public void setSumMarketPrice(BigDecimal sumMarketPrice) {
        this.sumMarketPrice = sumMarketPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
    }

    public BigDecimal getCostPrice() {
        return costPrice;
    }

    public void setCostPrice(BigDecimal costPrice) {
        this.costPrice = costPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
        this.count = this.count == null ? 1 : this.count;
        this.sumCostPrice = costPrice.multiply(BigDecimal.valueOf(this.count)).setScale(2, BigDecimal.ROUND_HALF_UP);
    }

    public BigDecimal getSumCostPrice() {
        return sumCostPrice;
    }

    public void setSumCostPrice(BigDecimal sumCostPrice) {
        this.sumCostPrice = sumCostPrice;
    }

    public String getFashionTitle() {
        return fashionTitle;
    }

    public void setFashionTitle(String fashionTitle) {
        this.fashionTitle = fashionTitle;
    }

    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    public String getFieldCode() {
        return fieldCode;
    }

    public void setFieldCode(String fieldCode) {
        this.fieldCode = fieldCode;
    }

    public String getFieldType() {
        return fieldType;
    }

    public void setFieldType(String fieldType) {
        this.fieldType = fieldType;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getValueName() {
        return valueName;
    }

    public void setValueName(String valueName) {
        this.valueName = valueName;
    }

    public Long getStockCount() {
        return stockCount;
    }

    public void setStockCount(Long stockCount) {
        this.stockCount = stockCount;
    }

    public Integer getLackRemind() {
        return lackRemind;
    }

    public void setLackRemind(Integer lackRemind) {
        this.lackRemind = lackRemind;
    }

    public String getProductCode() {
        return productCode;
    }

    public void setProductCode(String productCode) {
        this.productCode = productCode;
    }

    public String getCartItemId() {
        return cartItemId;
    }

    public void setCartItemId(String cartItemId) {
        this.cartItemId = cartItemId;
    }
}
